home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / domacnost a kancelar / avedesk / AveDesk13.exe / Effects / shake.effectlet < prev    next >
Text File  |  2004-07-10  |  3KB  |  147 lines

  1. <!--
  2.   preamble stuff you might say to someone
  3.   willing to open this in a text editor.
  4. -->
  5.  
  6. <?xml version="1.0" encoding="UTF-8"?>
  7. <effectlet>
  8.     <info>
  9.         <name>Shake Effect Script</name>
  10.         <author>Fabien LAMAISON @ KERIN</author>
  11.         <notes><![CDATA[
  12. I'm just trying to do
  13. some things here
  14.         ]]></notes>
  15.         <version>0.0.7</version>
  16.     </info>
  17.     <settings>
  18.         <param name="Debug" type="Boolean" defval="False"/>
  19.     </settings>
  20.     <preferences>
  21.         <preference name="MaxOffset" type="range"   defval="50" min="10" max="150">
  22.         How hard your icon will shake (in percent of the icon size). 
  23.         Drag the Slider to the desired Value.
  24.         </preference>
  25.         <preference name="Speed" type="range"   defval="5" min="2" max="8">
  26.         Define the speed of the bounce (2 is quick and 8 is very slow)
  27.       </preference>
  28.     </preferences>
  29.     <images>
  30.     </images>
  31.     <script engine="vbScript"><![CDATA[
  32.  
  33.     Dim Counter
  34.     Dim StartTop
  35.     Dim StartLeft
  36.     Dim TickRate
  37.     Dim isOver
  38.     Dim Offset
  39.     Dim MaxOffsetPx
  40.  
  41.     Sub OnCreate()
  42.         MaxOffset.value = 10
  43.         Speed.value = 5
  44.         isOver = false
  45.         OffsetX = 0
  46.         OffsetY = 0
  47.         TickRate = 100
  48.         Counter = 0
  49.         StartTop = Desklet.Top
  50.         StartLeft = Desklet.Left
  51.  
  52.         Preferences.ReadAll()
  53.         MaxOffsetPx = MaxOffset * Desklet.Height / 100
  54.     End Sub
  55.  
  56.     Sub OnMouseOn()
  57.         Ticker.Interval = TickRate
  58.         Ticker.Enabled = True
  59.         isOver = true
  60.     End Sub
  61.  
  62.     Sub OnMouseout()  
  63.         isOver = false
  64.         Ticker.Enabled = False
  65.         Desklet.Move StartLeft, StartTop
  66.     End Sub
  67.  
  68.     'Function OnBeforeDraw(IsMouseOn, IsSelected, IsPreview)
  69.     'End Function
  70.  
  71.     'Function OnAfterDraw(IsMouseOn, IsSelected, IsPreview)
  72.     'End Function
  73.     
  74.     Sub OnSave()
  75.         Preferences.SaveAll
  76.     End Sub
  77.  
  78.     'Optional. Indicates a preference change
  79.     Function OnPreferenceChange(Preference, oldValue, newValue)
  80.         MaxOffsetPx = MaxOffset * Desklet.Height / 100
  81.     End Function
  82.  
  83.  
  84.     Sub OnTimer()
  85.         if isOver then
  86.             OffsetX = Int((2*MaxOffsetPx + 1) * Rnd - MaxOffsetPx)
  87.             OffsetY = Int((2*MaxOffsetPx + 1) * Rnd - MaxOffsetPx)
  88.             Desklet.Move StartLeft+OffsetX,(StartTop - OffsetY)
  89.         End If
  90.         'Desklet.Redraw()
  91.     End Sub
  92.  
  93.     'Optional calls that we don't need for this script:
  94.  
  95.     'Sub OnSelect()   
  96.     'End Sub
  97.  
  98.     'Sub OnDeselect()   
  99.     'End Sub
  100.  
  101.     'Sub OnShow()         
  102.     'End Sub
  103.  
  104.     'Sub OnHide()         
  105.     'End Sub
  106.  
  107.     Sub OnConfigure() 
  108.         'the configuration dialog with default UI for
  109.         'XML preferences will be shown.
  110.         'An additional dialog designer is on its way. It will
  111.         'extend the available default preferences of type:
  112.         ' - slider, checkbox, combobox (builtin, v. 1.1, free on form with v. 1.2)
  113.         ' - textbox, file browser, favorites URL (builtin and free on form, v. 1.2)
  114.         ' - Any ocx (external, only free on form, v. 1.2)
  115.  
  116.     End Sub
  117.  
  118.     Sub OnStartMove() 
  119.             isOver = false
  120.         Ticker.Enabled = False
  121.     End Sub
  122.  
  123.     Sub OnEndMove()
  124.         StartLeft = Desklet.Left
  125.         StartTop = Desklet.Top
  126.         OnMouseOn
  127.     End Sub
  128.  
  129.     Sub OnLeftClick()  
  130.             isOver = false
  131.         Ticker.Enabled = False
  132.         Desklet.Move StartLeft, StartTop
  133.     End Sub
  134.  
  135.     Sub OnRightClick()
  136.         isOver = false
  137.         Ticker.Enabled = False
  138.         Desklet.Move StartLeft, StartTop
  139.     End Sub
  140.  
  141.     'Sub OnDestroy
  142.     'End Sub
  143.  
  144.  
  145.     ]]></script>
  146. </effectlet>
  147.